<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page trimDirectiveWhitespaces="true" %>
<style>
.mergefieldset {margin: 10px 0 15px ;}
	.mergefieldset span{ margin-right:20px; font-size: 14px; font-weight: bold; line-height: 35px;}
</style>
<fmt:setLocale value="zh_CN"/>
<div class="partshow">
	<div class="clearfix header shieldHeader cg_previre_title">
		<div style="float: left; width:95%;">
		<!-- noshield表示不执行shieldjs的处理 -->
<c:if test="${not empty model.modelFile }">
		<a href="javascript:void(0)" class="noshield cur">Model</a>
</c:if>
<c:if test="${not empty model.daoFile }">
		<a href="javascript:void(0)" class="noshield">DAO</a>
</c:if>
<c:if test="${not empty model.serviceFile }">
		<a href="javascript:void(0)" class="noshield">Service</a>
</c:if>
<c:if test="${not empty model.controllerFile }">
		<a href="javascript:void(0)" class="noshield">Controller</a>
</c:if>
<c:forEach var="jsp" items="${model.jspFiles }">
		<a href="javascript:void(0)" class="noshield">${jsp.name }</a>
</c:forEach>
</div>
		<a href="javascript:void(0)" class="noshield all" v="all">全部</a>
	</div>
	<div class="cg_previre_content">
<c:if test="${not empty model.modelFile }">
		<div class="cg_content" style="display: none;">
			<pre>
				<code><c:out value="${model.modelFile.content }"/></code>
			</pre>
		</div>
</c:if>
<c:if test="${not empty model.daoFile }">
		<div class="cg_content" style="display: none;">
			<pre>
				<code><c:out value="${model.daoFile.content }"/></code>
			</pre>
		</div>
</c:if>
<c:if test="${not empty model.serviceFile }">
		<div class="cg_content" style="display: none;">
			<pre>
				<code><c:out value="${model.serviceFile.content }"/></code>
			</pre>
		</div>
</c:if>
<c:if test="${not empty model.controllerFile }">
		<div class="cg_content" style="display: none;">
			<pre>
				<code><c:out value="${model.controllerFile.content }"/></code>
			</pre>
		</div>
</c:if>
<c:forEach var="jsp" items="${model.jspFiles }">
		<div class="cg_content" style="display: none;">
			<div class="cg_content_title">
				${jsp.name }
			</div>
			<pre>
				<code><c:out value="${jsp.content }"/></code>
			</pre>
		</div>
</c:forEach>
	</div>
</div>
<div style=" margin: 0 20px 50px 0px;padding: 20px;background: #f7f7f7;display: none;" class="partshow">
	<div style="margin:10px 0 0;"  >
		<span style="font-size: 14px; color: #f00;">共生成以下<b>${model.fileSize }</b>个文件
		<input style="margin-left: 15px;" type="button" value="生成文件" class="shieldAjax " paramSelector="#codegenform" 
				data-url="${ctxPathA}/system/codegen/gen" />
		<a target="_blank" href="javascript:void(0);" class="button1 downloadZipCode" style="display: none;">下载代码</a>
		</span>
	</div>
	<div class="mergefieldset">
<c:if test="${not empty model.modelFile }">
		<span>${model.modelFile.name }</span>
</c:if>
<c:if test="${not empty model.daoFile }">
		<span>${model.daoFile.name }</span>
</c:if>
<c:if test="${not empty model.serviceFile }">
		<span>${model.serviceFile.name }</span>
</c:if>
<c:if test="${not empty model.controllerFile }">
		<span>${model.controllerFile.name }</span>
</c:if>
<c:forEach var="jsp" items="${model.jspFiles }">
		<span>${jsp.name }</span>
</c:forEach>
	
	</div>
</div>
<script>
  	$('pre code').each(function(i, block) {
    	hljs.highlightBlock(block);
  	});
  	$(".cg_previre_title").find("a").click(function(){
  		var $this = $(this);
  		var thisIndex = $(".cg_previre_title").find("a").index($this);
  		$(".cg_previre_title").find("a").removeClass("cur");
  		$this.addClass("cur");
  		var v = $this.attr("v");
  		if (v && v=="all") {
  			$(".cg_previre_content").find("div.cg_content").show(); 
        } else {
	  		$(".cg_previre_content").find("div.cg_content").hide().eq(thisIndex).show();
        }
  	});
  	$(".cg_previre_title").find("a")[0].click();
</script>
